package models;

import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;

import play.db.jpa.Model;

@Entity
public class Cartorio extends Model {
	
	@OneToMany(cascade= {CascadeType.PERSIST, CascadeType.MERGE}, mappedBy = "cartorio")
	private Set<Processo> processos;

	@ManyToOne(cascade = CascadeType.ALL, optional = false)
	private Competencia competencia;
	
	@Column(nullable=false)
	private String nome;
	
	public Set<Processo> getProcessos() {
		return processos;
	}

	public void setProcessos(Set<Processo> processos) {
		this.processos = processos;
	}
	
	public String getNome() {
		return nome;
	}
	
	public void setNome(String nome) {
		this.nome = nome;
	}

	public void setCompetencia(Competencia competencia) {
		this.competencia = competencia;
	}

	public Competencia getCompetencia() {
		return competencia;
	}
}
